package base;

import java.awt.Point;

public class State {
	private Piece piece;
	
	/**
	 * The real location of the piece on the board.
	 */
	private Point location;
	
	/**
	 * Whether or not the piece is currently captured.
	 */
	private boolean alive;
	
	/**
	 * The player who currently owns the piece. A player who captures a piece gains ownership over it.
	 */
	private Player owner;
	
	/**
	 * The way the piece currently moves. If set to itself, it moves like itself. If set to another piece, it will move like that piece.
	 */
	private Piece upgrade;
	
	public Piece getPiece() {
		return piece;
	}
	
	/**
	 * Get the piece's location.
	 * @return A Point which represents the piece's current location on the board.
	 */
	public Point getLocation() {
		return location;
	}
	
	/**
	 * Check whether or not the piece is on the board.
	 * @return True if the piece is in play, false if it's captured.
	 */
	public boolean isAlive() {
		return alive;
	}
	
	/**
	 * Get the piece's owner.
	 * @return The Player which owns the piece.
	 */
	public Player getOwner() {
		return owner;
	}
	
	/**
	 * Get the currently applied upgrade.
	 * @return The piece it has been upgraded to, or a reference to the current instance of piece if it hasn't been upgraded.
	 */
	public Piece getUpgrade() {
		return upgrade;
	}
	
	public State(Piece piece, Point location, boolean alive, Player owner, Piece upgrade) {
		this.piece = piece;
		this.location = location;
		this.alive = alive;
		this.owner = owner;
		this.upgrade = upgrade;
	}
}
